<template>
  <page-body>
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center customers_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub customers_fd0_0'>
          <view class='flex flex-wrap align-center customers_fd0_0_c0'>
            <!-- <text class='fu-iconfont2  customers_fd0_0_c0_c0'>&#xE794;</text> -->
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='customers_fd0_0_c1_c0'>客户</text>
          </view>
          <view class='flex flex-wrap align-center justify-end customers_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-center justify-between benben-flex-layout customers_flex_1">
        <view class='flex flex-wrap align-center customers_fd1_0'>
          <image class='customers_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"150.png"'></image>
          <benben-input style="height: 70rpx;line-height: 70rpx;" type="text" :placeholder="`输入客户姓名/联系电话`"
            confirm-type="done" :maxlength="15" :adjust-position='true' placeholder-style="color:#999;font-size:28rpx"
            v-model="keywords" @confirm="getListFunc" />
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view>
          <benben-flex-tabs class-name='customers_benbenTabsfd2_0' v-model="cateId" ref="benben_tabsfd2_0"
            select-mark="benben_tabsfd2_0" key="benben_tabsfd2_0" :open-title-type='false' :open-sticky='false' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd2_0">

            <scroll-view @scroll="tabsInfofd2_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd2_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left.sync="tabsInfofd2_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd2_0-content">
                <view id="benben_tabsfd2_0-title" class="benben-tabs-title flex flex align-center justify-around">
                  <view :class="{ 'checkTitlefd2_0': cateId == '0', 'flex flex-wrap align-center': true }"
                    @tap="chooseStatus('0')" :id="`benben_tabsfd2_0-title-item-${'0'}`">

                    <text>全部</text>

                  </view>
                  <view :class="{ 'checkTitlefd2_0': cateId == '1', 'flex flex-wrap align-center': true }"
                    @tap="chooseStatus('1')" :id="`benben_tabsfd2_0-title-item-${'1'}`">

                    <text>意向客户</text>

                  </view>

                  <view :class="{ 'checkTitlefd2_0': cateId == '2', 'flex flex-wrap align-center': true }"
                    @tap="chooseStatus('2')" :id="`benben_tabsfd2_0-title-item-${'2'}`">

                    <text>成交客户</text>

                  </view>
                  <view :class="{ 'checkTitlefd2_0': cateId == '3', 'flex flex-wrap align-center': true }"
                    @tap="chooseStatus('3')" :id="`benben_tabsfd2_0-title-item-${'3'}`">

                    <text>跟进中客户</text>

                  </view>
                  <view :class="{ 'checkTitlefd2_0': cateId == '4', 'flex flex-wrap align-center': true }"
                    @tap="chooseStatus('4')" :id="`benben_tabsfd2_0-title-item-${'4'}`">

                    <text>未成交客户</text>

                  </view>
                </view>
                <view :style="{ left: tabsInfofd2_0.lineleft, maxWidth: tabsInfofd2_0.lineWidth ,}"
                  id="benben_tabsfd2_0-line" class="benben-tabs-line flex benben-flex-tabs-line customers_linefd2_0">
                </view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <template v-for='(item,flex3) in dataList'>
        <view class="flex flex-direction align-stretch benben-flex-layout customers_flex_3" :key='flex3'
          @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/grzx/custr/custr?aid=${item.aid}`">
          <view class='flex flex-wrap align-center justify-between customers_fd3_0'>
            <image class='customers_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"151.png"'></image>
            <view class='flex flex-direction align-stretch flex-sub customers_fd3_0_c1'>
              <view class='flex flex-wrap align-center customers_fd3_0_c1'>
                <text>{{item.customer_name}}</text>
                <!-- 跟进中 -->
                <image class='customers_fd3_0_c1_c0_c1' v-if="item.customer_types==3" mode="aspectFit"
                  :src='STATIC_URL+"155.png"'></image>
                <!-- 意向 -->
                <image class='customers_fd3_0_c1_c0_c1' v-if="item.customer_types==1" mode="aspectFit"
                  :src='STATIC_URL+"152.png"'></image>
                <!-- 成交 -->
                <image class='customers_fd3_0_c1_c0_c1' v-if="item.customer_types==2" mode="aspectFit"
                  :src='STATIC_URL+"153.png"'></image>
                <image class='customers_fd3_0_c1_c0_c1' mode="aspectFit" v-if="item.customer_types==4"
                  :src='STATIC_URL+"162.png"'></image>
              </view>
              <view class='flex flex-wrap align-center customers_fd3_0_c1_c1'>
                <text>{{item.customer_phone}}</text>
              </view>
            </view>
            <image class='customers_fd3_0_c2' mode="aspectFit" @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/custr/custr?aid=${item.aid}`" :src='STATIC_URL+"154.png"'></image>
          </view>
          <view class='flex flex-wrap align-end customers_fd3_1'>
            <text class='customers_fd3_1_c0'>{{item.customer_type_name}}日期：</text>
            <text>{{item.date_time}}</text>
          </view>
          <view class='flex  align-center justify-end'>
            <button class='self-end customers_fd3_2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/customerorders/customerorders?aid=${item.aid}`"
              v-if="item.customer_types==2">查看订单</button>
            <button class='self-end customers_fd3_2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/volumesize/volumesize?aid=${item.aid}`"
              v-if="item.customer_types==2">量体尺寸</button>
            <button class='self-end customers_fd3_2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/newCustomer/newCustomer?aid=${item.aid}`"
              v-if="item.customer_types!=2">客户类型</button>
            <button class='self-end customers_fd3_2_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/newfollowup/newfollowup?aid=${item.aid}`">添加跟进</button>
            <button class='self-end customers_fd3_2_c3' @tap.stop="handleJumpDiy" data-type="navigateTo"
              :data-url="`/pages/grzx/selectSales/selectSales?aid=${item.aid}`">移交</button>
          </view>
        </view>
      </template>
      <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
        :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      <!---flex布局flex布局结束-->
      <view class="flex flex-wrap align-center justify-center benben-position-layout flex customers_flex_4"
        @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/grzx/newCustomer/newCustomer`">
        <text class='self-center'>新建
          客户</text>

      </view>
      <view :style="{height: '128rpx'}"></view>


    </view>
  </page-body>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "tabsInfofd2_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "cateId": "0",
        "dataList": [],
        "keywords": "",
        "cid": ""
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {
      let {
        keyword,
        cid
      } = options
      if (keyword !== undefined) this.keyword = keyword
      if (cid !== undefined) this.cid = cid
      // if (!uni.getStorageSync('intoType')) {
      //   this.getListFunc()
      // }
      // this.getListFunc()


    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      if (uni.getStorageSync('tab2')) {
        this.cateId = uni.getStorageSync('tab2')

      }
      this.getListFunc()


    },
    onHide() {
      // uni.setStorageSync('intoType', '')
      uni.setStorageSync('tab2', '0')
    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      chooseStatus(type) {
        this.cateId = type
        this.getListFunc()
      },
      getListFunc() {
        this.minixPagingListsApi = global.apiUrls.post666d585932fbf;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          keywords: this.keywords,
          customer_types: this.cateId
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      },
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .customers_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .customers_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .customers_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .customers_fd0_0_c0 {
    width: 120rpx;
  }

  .customers_fd0_0 {

    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .customers_flex_1 {
    background: var(--benbenbgColor1);
    padding: 24rpx;
    background-size: 100% auto;
  }

  .customers_fd1_0_c0 {
    width: 24rpx;
    height: 24rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .customers_fd1_0 {
    background: #F8F8F8;
    border-radius: 34rpx;
    width: 686rpx;
    height: 64rpx;
    line-height: 64rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
  }

  .customers_linefd2_0 {
    background: rgba(228, 195, 145, 1);
    width: 60rpx;
    height: 8rpx;
    border-radius: 16rpx;
    top: 80rpx;
    background-size: 100% auto !important;
  }

  .checkTitlefd2_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #333 !important;
    background-color: #F8F8F8 !important;
  }

  ::v-deep .customers_benbenTabsfd2_0 {
    background: var(--benbenbgColor0);
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    color: rgba(102, 102, 102, 1);
  }

  .customers_flex_3 {
    background: rgba(255, 255, 255, 1);
    margin: 26rpx 24rpx 0rpx 24rpx;
    padding: 24rpx;
    border-radius: 26rpx;
    background-size: 100% auto;
  }

  .customers_fd3_2_c3 {
    background: #F9E4C3;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 200rpx;
    line-height: 72rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor0);
    height: 72rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .customers_fd3_2_c0 {
    background: rgba(228, 195, 145, 0.3);
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 200rpx;
    line-height: 72rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor0);
    height: 72rpx;
    margin: 24rpx 16rpx 0rpx 0rpx;
  }

  .customers_fd3_1_c0 {
    color: rgba(170, 170, 170, 1);
  }

  .customers_fd3_1 {
    // border-bottom: 1px solid #eee;
    padding: 24rpx 0rpx 24rpx 0rpx;
    font-size: 32rpx;
  }

  .customers_fd3_0_c2 {
    width: 42rpx;
    height: 42rpx;
  }

  .customers_fd3_0_c1_c1 {
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .customers_fd3_0_c1_c0_c1 {
    width: 115rpx;
    height: 34rpx;
    margin: 0rpx 0rpx 0rpx 16rpx;
  }

  .customers_fd3_0_c1 {
    font-size: 32rpx;
    font-weight: 600;
  }

  .customers_fd3_0_c0 {
    width: 62rpx;
    height: 67rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .customers_fd3_0 {
    border-bottom: 1px solid #eee;
    padding: 0rpx 0rpx 24rpx 0rpx;
  }

  .customers_flex_4 {
    background: #FFFFFF;
    width: 128rpx;
    height: 128rpx;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0rpx 3rpx 15rpx 1rpx rgba(223, 188, 134, 0.51);
    bottom: calc(100rpx + var(--window-bottom));
    right: 32rpx;
    border-radius: 100rpx;
  }
</style>
